<?php
require_once './database/connection.php';
require_once './database/articles.php';
require_once './database/modify.php';
$obj = new articles();
$data = $obj->view_all();
$mod = new modify_data();
?>
<div id="content">
        <div class="post">
            <form method="post" action="content3.php">
                <p>Chọn số id dòng bạn muốn xóa</p> <input type="text" name="dong"><br>
                <input type="submit" name="xoa" value="xoa">
                <table>
                    <tr>
                        <td>id</td>
                        <td>title</td>
                        <td>overview</td>
                        <td>id_category</td>
                    </tr>
                    <?php
                    foreach ($data as $dulieu){
                        echo "<tr><td>".$dulieu['id']."</td><td>".$dulieu['title']."</td><td>".$dulieu['overview']."</td><td>".$dulieu['id_category']."</td>";
                    }
                    ?>
                </table>
            </form>
<?php 
    if(isset($_POST['xoa'])){
        $mod->xoa_data();
        echo 'xoá thành công';
        header("Location: index.php");
    }
?>
        </div>
    <!-- DC Pagination:A1 Start -->
    <!-- DC Pagination:A1 End -->
</div>

